require "config"

require "tool"

module(..., package.seeall)

function proc(mqttClient)
    local result, data
    while true do
        result, data = mqttClient:receive(2000)
        if result then
            log.info("***********RECEIVE_TOPIC***********", data.topic)
            log.info("***********RECEIVE_DATA***********", data.payload)
            hwCMD.hwCMD(data.topic, data.payload)
            if hwOutMsg.waitForSend() then
                return true
            end
        else
            break
        end
    end
    return result or data=="timeout" or data=="APP_SOCKET_SEND_DATA"
end